
import 'package:flutter/material.dart';

///
/// list_view_demo2.dart
///
/// ListView 横向滚动的示例
///
///

void main() => runApp(const MaterialApp(home: ListViewDemoWidget2()));

class ListViewDemoWidget2 extends StatelessWidget {
  const ListViewDemoWidget2({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('ListView demo 2 横向滚动的ListView')),
      body: ListView(
        scrollDirection: Axis.horizontal,
        itemExtent: 140, // item延展尺寸（宽度）
        children: [
          Container(color: Colors.black,),
          Container(color: Colors.red,),
          Container(color: Colors.blue,),
          Container(color: Colors.green,),
          Container(color: Colors.yellow,),
          Container(color: Colors.orange,),
        ],
      ),
    );
  }
}


